Fixed pin id parsing in CLI.
[betaflight.git] / docs / development / Configuration Storage.md
blob97380512635d5c12d295e05762ae99564fd2c08b
1 # Configuration
3 The configuration in cleanflight is stored at the end of the flash ram, currently it uses 2-4KB of flash depending on the target.
5 Sometimes it's necessary to erase this during development.
7 ## Erasing
9 Generate a 2-4kb blank file.
11 2kb:
12 ```
13 dd if=/dev/zero of=obj/blankconfig.bin bs=1024 count=2
14 ```
16 4kb:
17 ```
18 dd if=/dev/zero of=obj/blankconfig.bin bs=1024 count=4
19 ```
21 Overwrite configuration using JLink
23 Run JLink (OSX: `/Applications/SEGGER/JLink/JLinkExe`)
25 Execute commands
26 `device <your device>`, e.g. `STM32F303CB`
27 `r`
28 `h` 
29 `loadbin obj/blankconfig.bin, <address>`
30 `r` to Reboot FC.
31 `q` to quit
34 the address is the address of the end of the flash ram minus the size of the configuration.
36 example addresses:
37 ```
38 64k device/2kb config = 0x800F800
39 128k device/2kb config = 0x801F800
40 128k device/4kb config = 0x801F000
41 256k device/2kb config = 0x803f800
42 256k device/4kb config = 0x803f000
43 ```
45 Example session
47 ```
48 $ /Applications/SEGGER/JLink/JLinkExe
49 SEGGER J-Link Commander V4.90c ('?' for help)
50 Compiled Aug 29 2014 09:52:38
51 DLL version V4.90c, compiled Aug 29 2014 09:52:33
52 Firmware: J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
53 Hardware: V7.00
54 S/N: -1 
55 Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFull 
56 VTarget = 3.300V
57 Info: Could not measure total IR len. TDO is constant high.
58 Info: Could not measure total IR len. TDO is constant high.
59 No devices found on JTAG chain. Trying to find device on SWD.
60 Info: Found SWD-DP with ID 0x2BA01477
61 Info: Found Cortex-M4 r0p1, Little endian.
62 Info: FPUnit: 6 code (BP) slots and 2 literal slots
63 Info: TPIU fitted.
64 Info: ETM fitted.
65 Cortex-M4 identified.
66 Target interface speed: 100 kHz
67 J-Link>device STM32F303CC
68 Info: Device "STM32F303CC" selected (256 KB flash, 32 KB RAM).
69 Reconnecting to target...
70 Info: Found SWD-DP with ID 0x2BA01477
71 Info: Found SWD-DP with ID 0x2BA01477
72 Info: Found Cortex-M4 r0p1, Little endian.
73 Info: FPUnit: 6 code (BP) slots and 2 literal slots
74 Info: TPIU fitted.
75 Info: ETM fitted.
76 J-Link>r
77 Reset delay: 0 ms
78 Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
79 J-Link>h
80 PC = 08001154, CycleCnt = 00000000
81 R0 = 00000000, R1 = 00000000, R2 = 00000000, R3 = 00000000
82 R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000
83 R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
84 R12= 00000000
85 SP(R13)= 2000A000, MSP= 2000A000, PSP= 00000000, R14(LR) = FFFFFFFF
86 XPSR = 01000000: APSR = nzcvq, EPSR = 01000000, IPSR = 000 (NoException)
87 CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
88 FPU regs: FPU not enabled / not implemented on connected CPU.
89 J-Link>loadbin obj/blankconfig.bin, 0x803f800
90 Downloading file [obj/blankconfig.bin]...
91 WARNING: CPU is running at low speed (7989 kHz).
92 Info: J-Link: Flash download: Flash programming performed for 1 range (2048 bytes)
93 Info: J-Link: Flash download: Total time needed: 1.254s (Prepare: 0.698s, Compare: 0.009s, Erase: 0.075s, Program: 0.405s, Verify: 0.005s, Restore: 0.059s)
94 O.K.
95 J-Link>r
96 Reset delay: 0 ms
97 Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
98 J-Link>q
99 ```